home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
A.C.E. 2
/
ACE CD 2.iso
/
FILES
/
UTILS
/
AMOS3.DMS
/
AMOS3.adf
/
AMAL_Editor.AMOS
/
AMAL_Editor.amosSourceCode
next >
Wrap
AMOS Source Code
|
1988-10-24
|
40KB
|
1,493 lines
' AMAL Editor
'
' By Francois Lionet
'
' (c) 1990 Mandarin / Jawx
'
' Please note that the AMAL Example file on this disc will NOT
' run on an A500 machine. You can though view the AMAL program
' from the editor.
'
' Increase text buffer for really big programs!
Set Buffer 24
' Maximum number of lines for each string
MXLINE=200
' Editor screen size
HSC=200
' Editor screen position at start
SCY=50
' If you are low in memory!
Close Editor
Dim AM$(64),ED$(MXLINE),M$(5),FLG(4),REGA(26+10)
Global AM$(),ED$(),MXLINE,NSTR,LIM$,M$(),FLG()
Global CST,CUX,CUY,WIY,BLS,BLE,WSY,LLAST,CCH
Global NBMOVE,CPL,PLOFF,PLLEN,PLNAME,PLMOVE,SYNC
Global EDHID,ALARM,ALARM$,SEL0,SEL1,NAME$,ID$
Global HSC,SCY
'
Screen Open 7,640,HSC,4,Hires
Screen Display 7,,350,, : EDHID=1
Reserve Zone 120
WSY=HSC/8-5
Wind Open 1,0,32,80,WSY : Scroll Off
Set Zone 64,0,0 To 640,15
Set Zone 65,0,HSC-7 To 640,HSC
Set Paint 1 : Set Pattern 0 : Ink 0,0,2 : Bar 0,HSC-7 To 639,HSC-1
Limit Mouse 112,0 To 450,311
'
NBMOVE=48
PLOFF=6
PLLEN=PLOFF+NBMOVE*2
PLNAME=PLLEN+NBMOVE*2
PLMOVE=PLNAME+NBMOVE*8
CPL=1 : CST=1 : CCH=1 : SYNC=1
SEL0=-1 : SEL1=-1
NSTR=16 : LIM$="~"
REED_BANK
'----------------------------------------------------------------------------
_EDIT:
ED_SHOW
MAKE_ED[CST]
ED_INFO : DISP_WIND : SET_STR
MAKE_EDIT
DR_STR[CST,NSTR,1]
Set Zone 66,0,32 To 640,HSC
Show On : Sprite Off : Clear Key
Do
Menu On
Repeat
Wait Vbl
If ALARM
Dec ALARM
If ALARM=0 : ED_INFO : End If
End If
MVE_ED
Z=Mouse Zone : K=Mouse Key and 1 : C=Choice : K$=Inkey$ : S=Scancode : SS=Scanshift
Until K$<>"" or K<>0 or C<>0
If C
TK_CUR
On Choice(1) Gosub ED_AMOS,ED_EDIT,ED_DISC,ED_OPT,ED_BLOCK
K=0 : K$="" : S=0
End If
Menu Off
P=0 : P$="" : CY=CUY+WIY
If K
If Z>0
If Z<=NSTR+1 and CST<>Z-1
DR_STR[CST,NSTR,0] : MAKE_AM[CST,0,LLAST]
CST=Z-1 : DR_STR[CST,NSTR,1] : MAKE_ED[CST] : DISP_WIND : ED_INFO
End If
If Z=66
X=X Screen(X Mouse)/8 : Y=(Y Screen(Y Mouse)-32)/8
If WIY<=LLAST and Y<20
TK_CUR
If Y+WIY<=LLAST
CUX=Min(Len(ED$(Y+WIY)),X) : CUY=Y : Locate CUX,CUY : INF_X : INF_Y
End If
End If
End If
End If
End If
If K$<" "
D=1 : If SS and %1011 : D=WSY-1 : End If
If S=$42
Clear Key : N=4-(CUX mod 4) : Put Key Space$(N) : S=0
End If
If S=79
If SS and %11000000
DR_STR[CST,NSTR,0] : MAKE_AM[CST,0,LLAST]
Add CST,-D,0 To NSTR : DR_STR[CST,NSTR,1] : MAKE_ED[CST] : DISP_WIND : ED_INFO
Else
S=0 : Add CUX,-D : CUX=Max(0,CUX) : Locate CUX, : INF_X
End If
End If
If S=78
If SS and %11000000
DR_STR[CST,NSTR,0] : MAKE_AM[CST,0,LLAST]
Add CST,D,0 To NSTR : DR_STR[CST,NSTR,1] : MAKE_ED[CST] : DISP_WIND : ED_INFO
Else
S=0 : Add CUX,D : CUX=Min(Min(Len(ED$(CY)),CUX),79) : Locate CUX, : INF_X
End If
End If
If S
TK_CUR
If K$=Chr$(13)
If Param<>0 and CY<MXLINE
I_LINE[CY+1]
If Param
ED$(CY+1)=Mid$(ED$(CY),CUX+1)
ED$(CY)=Left$(ED$(CY),CUX) : DISP_WIND
CUX=0
If ED$(CY)<>"" : S=77 : SS=0 : End If
End If
End If
End If
If S=76
Add CUY,-D
If CUY>=0
CUX=Min(Len(ED$(CUY+WIY)),CUX) : Locate CUX,CUY : INF_X : INF_Y
Else
E=CUY : CUY=0
If D=1
If WIY : Dec WIY : Vscroll 1 : DISP_LINE[WIY] : End If
Else
Add WIY,E : WIY=Max(0,WIY) : DISP_WIND
End If
CUX=Min(Len(ED$(CUY+WIY)),CUX) : Locate CUX,CUY : INF_X : INF_Y
End If
K$=""
End If
If S=77
If WIY+CUY+D>LLAST : D=LLAST-CUY-WIY : End If
Add CUY,D
If CUY<WSY
CUX=Min(Len(ED$(CUY+WIY)),CUX) : Locate CUX,CUY : INF_X : INF_Y
Else
Add WIY,CUY-WSY+1 : CUY=WSY-1
If D=1
Vscroll 3 : DISP_LINE[WIY+CUY]
Else
DISP_WIND
End If
CUX=Min(Len(ED$(CUY+WIY)),CUX) : Locate CUX,CUY : INF_X : INF_Y
End If
K$=""
End If
If S=65
If CUX
ED$(CY)=Left$(ED$(CY),CUX-1)+Mid$(ED$(CY),CUX+1)
Dec CUX : Inc P : P$=" "
Else
If CY and CUY<>0
CUX=Min(Len(ED$(CY-1)),79)
ED$(CY-1)=ED$(CY-1)+ED$(CY) : D_LINE[CY] : Dec CUY
DISP_WIND
End If
End If
End If
If S=70
ED$(CY)=Left$(ED$(CY),CUX)+Mid$(ED$(CY),CUX+2)
Inc P : P$=" "
If SS and 3 : ED$(CY)="" : Inc P : P$=Chr$(26) : CUX=0 : End If
End If
End If
End If
U$=Upper$(K$)
If SS=%1000
If U$="Y"
If CY<LLAST : D_LINE[CY] : End If
DISP_WIND : K$=""
End If
TK_CUR
If U$="B" : BL_S : End If
If U$="E" : BL_E : End If
If U$="K" : BL_CUT : End If
If U$="P" : BL_PASTE : End If
If U$="H" : BL_HIDE : End If
K$=""
End If
If K$>=" "
ED$(CY)=Left$(ED$(CY),CUX)+K$+Mid$(ED$(CY),CUX+1)
If CUX<79 : Inc CUX : End If
Inc P
End If
If P
CY=CUY+WIY : Locate 0,
Inverse Off : If CY>=BLS and CY<BLE : Inverse On : End If
Print Left$(ED$(CY),79); : Inverse Off : Print P$;
Locate CUX,CUY
End If
Loop
'
ED_DISC: Pop
MAKE_AM[CST,0,LLAST]
On Choice(2) Goto _LOAD,_LOAD,_SAVE,_SAVAS
'
ED_EDIT: Pop
MAKE_AM[CST,0,LLAST]
On Choice(2) Goto _RUNALL,_RUNCUR,_RUNSEL,_EDIT,_DEBUG,_EDIT,_PLAY
'
ED_OPT:
On Choice(2) Proc O_SYNC,O_PER,SET_SEL
Return
'
ED_BLOCK:
On Choice(2) Proc BL_S,BL_E,BL_HIDE,BL_S,BL_CUT,BL_PASTE,BL_S,BL_PRINT,ST_PRINT
Return
'
ED_AMOS:
MAKE_AM[CST,0,LLAST]
On Choice(2) Proc AM_ABOUT,AM_ABOUT,AM_QUIT,AM_SYSTEM
Return
'
Procedure O_SYNC
If NSTR<60
NSTR=62
SET_STR
Else
NSTR=16
SET_STR
If CST>NSTR
MAKE_AM[CST,0,LLAST]
CST=1 : DR_STR[CST,NSTR,1] : DISP_WIND
End If
End If
MN_SYNC
End Proc
Procedure O_PER
Clw
Print : Centre "When SYNCHRO OFF, how many 50th of second shall I wait"
Print : Centre "between each SYNCHRO?"
Print : Centre " " : INP_TEXT[Str$(SYNC)-" ",2]
SYNC=Val(Param$)
If SYNC<=0 or SYNC>=99 : SYNC=1 : End If
DISP_WIND
End Proc
Procedure BL_S
BLS=CUY+WIY : DISP_WIND
End Proc
Procedure BL_E
BLE=CUY+WIY : DISP_WIND
End Proc
Procedure BL_CLR
ED$(64)=""
End Proc
Procedure BL_HIDE
BLS=BLE : DISP_WIND
End Proc
Procedure BL_CUT
X=Free
If BLE>BLS and BLE<=LLAST
MAKE_AM[64,BLS,BLE-1]
D=BLE-BLS
For N=BLS To LLAST-D : ED$(N)=ED$(N+D) : Next
Add LLAST,-D
CUX=0 : Y_CENTRE[BLS] : BLS=0 : BLE=0 : DISP_WIND
End If
End Proc
Procedure BL_PASTE
X=Free
If AM$(64)<>""
P=21 : S=CUY+WIY
Do
Q=Instr(AM$(64),LIM$,P)
Exit If Q=0 or S>=MXLINE or LLAST>=MXLINE-1
If LLAST : For N=LLAST To S+1 Step -1 : ED$(N)=ED$(N-1) : Next : End If
ED$(S)=Mid$(AM$(64),P,Q-P)
P=Q+1 : Inc S : Inc LLAST
Loop
DISP_WIND
ED$(LLAST)=""
End If
End Proc
Procedure BL_PRINT
On Error Goto E_PRINT
ED_ALARM["Printing... Press any key to stop.",1]
If BLE>BLS and BLE<=LLAST
For N=BLS To BLE-1
Lprint ED$(N)
Next
End If
E_PR: On Error
Pop Proc
E_PRINT: ED_ALARM["Printer strike!",250] : Bell
Resume E_PR
End Proc
Procedure ST_PRINT
S=BLS : E=BLE
BLS=0 : BLE=LLAST
BL_PRINT
BLS=S : BLE=E
End Proc
Procedure Y_CENTRE[Y]
If Y>=WIY and Y<WIY+WSY
CUY=Y-WIY
Else
CUY=0 : WIY=Y
End If
End Proc
Procedure TK_CUR
Shared CY
If ED$(CY)<>""
For L=1 To Len(ED$(CY))
If Mid$(ED$(CY),L,1)<>" " : F=1 : Exit : End If
Next L
End If
If F=0 and CY<LLAST
D_LINE[CY] : CUX=0
DISP_WIND
End If
If F<>0 and CY=LLAST
If LLAST<MXLINE
Inc LLAST
ED$(LLAST)=""
Else
Bell : ED$(CY)="" : CUX=0 : DISP_WIND
End If
End If
End Proc[F]
Procedure D_LINE[N]
For M=N To LLAST-1 : ED$(M)=ED$(M+1) : Next
ED$(LLAST)=""
Dec LLAST
If BLS>N : Dec BLS : End If
If BLE>N : Dec BLE : End If
End Proc
Procedure I_LINE[L]
If LLAST<MXLINE
If L<MXLINE
For N=MXLINE-1 To L Step -1
ED$(N+1)=ED$(N)
Next
Inc LLAST
If BLS>L : Inc BLS : End If
If BLE>L : Inc BLE : End If
End If
ED$(L)=""
F=-1
End If
End Proc[F]
Procedure MAKE_ED[N]
For S=0 To MXLINE : ED$(S)="" : Next
X=Free
If AM$(N)=""
CUX=0 : CUY=0 : WIY=0 : BLS=0 : BLE=0
Else
CUX=Val(Mid$(AM$(N),1+4*0,4))
CUY=Val(Mid$(AM$(N),1+4*1,4))
WIY=Val(Mid$(AM$(N),1+4*2,4))
BLS=Val(Mid$(AM$(N),1+4*3,4))
BLE=Val(Mid$(AM$(N),1+4*4,4))
P=21 : S=0
Do
Q=Instr(AM$(N),LIM$,P)
Exit If Q=0
ED$(S)=Mid$(AM$(N),P,Q-P)
P=Q+1 : Inc S
Loop
LLAST=S
End If
End Proc
Procedure MAKE_AM[N,Y1,Y2]
X=Free
AM$(N)=Hex$(CUX,3)+Hex$(CUY,3)+Hex$(WIY,3)+Hex$(BLS,3)+Hex$(BLE,3)
For S=Y1 To Y2
Exit If ED$(S)=""
AM$(N)=AM$(N)+ED$(S)+LIM$
Next
X=Free
End Proc
Procedure DISP_WIND
Curs Off
For N=WIY To WIY+WSY-1 : DISP_LINE[N] : Next
Locate CUX,CUY
Curs On
INF_X : INF_Y
End Proc
Procedure DISP_LINE[N]
Locate 0,N-WIY : Inverse Off : Cline
If N>=BLS and N<BLE
Inverse On
End If
If N<=LLAST : Print Left$(ED$(N),79); : End If
End Proc
Procedure SET_STR
CL_STR
For N=0 To NSTR : DR_STR[N,NSTR,0] : Next
End Proc
Procedure CL_STR
Y=12
Cls 0,0,Y To 640,31
Ink 2,0,2 : Set Paint 1 : Set Pattern 2 : Bar 0,Y To 639,Y+18
End Proc
Procedure ED_INFO
Cls 0,0,0 To 640,12
Set Paint 1 : Set Pattern 0 : Ink 0,0,2 : Bar 0,0 To 639,12
If ALARM
Ink 3,0 : Text 16,3+Text Base,ALARM$
Else
Ink 2,0 : Text 16,3+Text Base,"AMAL string editor"
INF_X : INF_Y
If CST=0
A$="Environnement string..."
Else
A$="AMAL channel number"+Str$(CST-1)
End If
Text 54*8,3+Text Base,A$
End If
End Proc
Procedure INF_X
If ALARM=0
X=30*8
Cls 0,X,3 To X+48,11
Ink 2,0 : Text X,3+Text Base,"C:"+Str$(CUX)
End If
End Proc
Procedure INF_Y
If ALARM=0
X=38*8
Cls 0,X,3 To X+48,11
Ink 2,0 : Text X,3+Text Base,"L:"+Str$(CUY+WIY)
End If
End Proc
Procedure MVE_ED
M=Mouse Zone
If M=64 or M=65
D=Y Mouse-SCY
While Mouse Key=1
SCY=Y Mouse-D
Screen Display 7,,SCY,,
Wait Vbl
Wend
End If
End Proc
Procedure ED_HIDE
If EDHID=0
For Y=SCY To 350 Step 16
Screen Display 7,,Y,,
Wait Vbl
Next
EDHID=-1
End If
End Proc
Procedure ED_SHOW
Wait 2 : Screen To Front 7
If EDHID
For Y=350 To SCY Step -16
Screen Display 7,,Y,,
Wait Vbl
Next
EDHID=0
End If
Screen Display 7,,SCY,,
Screen 7 : Colour 3,$FF0
Wait Vbl
X=Free
End Proc
Procedure MAKE_EDIT
Menu Del
Paper 2 : Pen 0
'
Menu$(1)=" AMOS "
Menu$(1,1)=" About AMAL editor "
Menu$(1,2)="------------------------" : Menu Inactive(1,2)
Menu$(1,3)=" Quit Esc " : Menu Key(1,3) To 69
Menu$(1,4)=" Back to system " : Menu$(1,4,1)=" Really? "
'
Menu$(2)=" Edit "
Menu$(2,1)=" Run all F1 " : Menu Key(2,1) To 80
Menu$(2,2)=" Run current F2 " : Menu Key(2,2) To 81
Menu$(2,3)=" Run selected F3 " : Menu Key(2,3) To 82
Menu$(2,4)="--------------------" : Menu Inactive(2,4)
Menu$(2,5)=" Debug F4 " : Menu Key(2,5) To 83
Menu$(2,6)="--------------------" : Menu Inactive(2,6)
Menu$(2,7)=" Play editor F5 " : Menu Key(2,7) To 84
'
Menu$(3)=" Disc "
Menu$(3,1)=" Load AMAL bank "
Menu$(3,2)="----------------" : Menu Inactive(3,2)
Menu$(3,3)=" Save AMAL bank "
Menu$(3,4)=" Save As... "
'
Menu$(4)=" Options "
Menu$(4,2)=" Set period "
Menu$(4,3)=" Set selected " : Menu Key(4,3) To 83
'
Menu$(5)=" Block "
Menu$(5,1)=" Block start F6 " : Menu Key(5,1) To 85
Menu$(5,2)=" Block end F7 " : Menu Key(5,2) To 86
Menu$(5,3)=" Block hide F8 " : Menu Key(5,3) To 87
Menu$(5,4)="------------------" : Menu Inactive(5,4)
Menu$(5,5)=" Block cut F9 " : Menu Key(5,5) To 88
Menu$(5,6)=" Block paste F10" : Menu Key(5,6) To 89
Menu$(5,7)="------------------" : Menu Inactive(5,7)
Menu$(5,8)=" Block print "
Menu$(5,9)=" String print "
'
Paper 1 : Pen 2
MN_SYNC
'
End Proc
Procedure MN_SYNC
Paper 2 : Pen 0
A$=" Synchro off " : B$=" Synchro on "
If NSTR<60 : Swap A$,B$ : End If
Menu$(4,1)=A$,B$
Paper 1 : Pen 2
End Proc
Procedure SET_SEL
'
Menu Off
Cls 0,0,0 To 640,12
Set Paint 1 : Set Pattern 0 : Ink 0,0,2 : Bar 0,0 To 639,12
Ink 2,0 : Text 30*8,3+Text Base,"RUN selected channels:"
Curs Off : Clw : Print : Centre ">>> Press spacebar to end <<<"
'
FLG(0)=SEL0 : FLG(1)=SEL0
CL_STR
For N=0 To NSTR
TST_FLG[N]
If Param
DR_STR[N,NSTR,1]
Else
DR_STR[N,NSTR,0]
End If
Next
'
Do
Repeat
MVE_ED
Z=Mouse Zone : K=Mouse Key and 1 : K$=Inkey$
Until K$<>"" or K<>0
'
If K<>0 and Z<>0 and Z<=NSTR+1
TST_FLG[Z-1]
If Param
CLR_FLG[Z-1]
DR_STR[Z-1,NSTR,0]
Else
SET_FLG[Z-1]
DR_STR[Z-1,NSTR,1]
End If
While Mouse Key : Wend
End If
Exit If K$=" "
Loop
SEL0=FLG(0) : SEL1=FLG(1)
'
ED_INFO : SET_STR : DR_STR[CST,NSTR,1] : DISP_WIND
End Proc
'
_LOAD:
F$=Fsel$("*.Abk","","Load an AMAL bank")
If Upper$(Right$(F$,4))=".ABK"
ED_ALARM["Loading "+F$+"...",1]
Erase 4
On Error Goto E_LOAD
Load F$
NAME$=F$
Else
Bell
End If
E_LD: On Error
REED_BANK
Goto _EDIT
E_LOAD: ED_ALARM["Disc error!",200] : Bell : Resume E_LD
'
_SAVE:
If NAME$<>""
BANK_SAVE : Goto _EDIT
End If
'
_SAVAS:
F$=Fsel$("*.Abk","","Save AMAL bank")
If Upper$(Right$(F$,4))=".ABK"
NAME$=F$
BANK_SAVE
Else
Bell
End If
Goto _EDIT
'
Procedure BANK_SAVE
ED_ALARM["Saving "+NAME$+"...",1]
MAKE_BANK
On Error Goto E_SAVE
Save NAME$,4
E_SV: PL_CLEAN[4] : On Error
Pop Proc
'
E_SAVE: ED_ALARM["Disc error!",200] : Bell : Resume E_SV
End Proc
Procedure REED_BANK
For N=0 To 62 : AM$(N)="" : Next
If Length(4)
If Leek(Start(4))
AO=Start(4)+Leek(Start(4))
NS=Deek(AO) : Add AO,2
AP=AO+64*2
AM_PIK[0,AP] : AP=Param
For N=1 To NS
AM_PIK[N,AP] : AP=Param
Next
PL_CLEAN[16]
Else
Erase 4 : Goto _NBANK
End If
Else
_NBANK:
Reserve As Data 4,PLMOVE+16
PKSTR["Amal ",Start(4)-8]
Doke Start(4)+4,NBMOVE : Add AD,2
For N=0 To NBMOVE-1 : PKSTR["Empty ",Start(4)+PLNAME+N*8] : Next
AM$(0)="$000$000$000$000$000Bob off : Sprite Off : Rainbow Del"+LIM$+"Screen 0"+LIM$
End If
CST=1 : CCH=0 : CPL=1
End Proc
Procedure AM_PIK[N,AP]
L=Deek(AP) : Add AP,2
If L
AM$(N)="$000$000$000$000$000"+Space$(L)
If Btst(0,L) : Inc L : End If
Copy AP,AP+L To Varptr(AM$(N))+20
Add AP,L
End If
End Proc[AP]
Procedure MAKE_BANK
AM_LONG : LS=Param
PL_CLEAN[LS+64*2+16]
BKLEN : Loke Start(4),Param
AO=Start(4)+Param
Doke AO,63 : Add AO,2
AP=AO+64*2
AM_POK[0,AP] : AP=Param
For N=1 To 62
Doke AO-2+N*2,(AP-AO)/2
AM_POK[N,AP] : AP=Param
Next
End Proc
Procedure AM_POK[N,AP]
A$=Mid$(AM$(N),21) : L=Len(A$)
Doke AP,L : Add AP,2
If Btst(0,L) : Inc L : End If
If L : Copy Varptr(A$),Varptr(A$)+L To AP : End If
Add AP,L
End Proc[AP]
Procedure AM_LONG
For N=0 To 62
S=Len(AM$(N))-20 : If S<0 : S=0 : End If
If Btst(0,S) : Inc S : End If
Add L,S+2
Next
End Proc[L]
Procedure ED_ALARM[A$,L]
Shared ALARM$,ALARM
ALARM$=A$
ALARM=L
ED_INFO
End Proc
'----------------------------------------------------------------------------
Procedure AM_ABOUT
Clw
Print At(20,3)+Border$(At(60,9),1)
Centre At(,4)+"AMAL editor"
Centre At(,5)+"-----------"
Centre At(,6)+"By Fran�ois Lionet"
Centre At(,8)+"(c) 1990 Mandarin / Jawx"
Centre At(,14)+"Text buffer free space:"+Str$(Free)
Centre At(,15)+"Free chip memory:"+Str$(Chip Free)
Centre At(,16)+"Free fast memory:"+Str$(Fast Free)
Print At(20,14)+Border$(At(60,16),1)
Clear Key : Curs Off : Repeat : MVE_ED : Until Inkey$<>"" or Mouse Key<>0
DISP_WIND : Curs On
End Proc
Procedure AM_QUIT
If Dreg(0)=0
A$="Quit AMAL editor (Y/N) ?"
Else
A$="Quit AMAL editor and grab AMAL bank (Y/N) ?"
End If
ED_ALARM[A$,1]
MAKE_BANK
Clear Key : Repeat : A$=Inkey$ : Until A$<>""
If Upper$(A$)="Y"
If Dreg(0)=0
For N=1 To 15 : Erase N : Next
Edit
End If
End If
PL_CLEAN[16]
End Proc
Procedure AM_SYSTEM
System
End Proc
'----------------------------------------------------------------------------
_DEBUG:
'
Menu Off
Curs Off
FLG(0)=SEL0 : FLG(1)=SEL1
INIT_RUN
Synchro Off
'
Cls 0,0,0 To 640,12
Set Paint 1 : Set Pattern 0 : Ink 0,0,2 : Bar 0,0 To 639,12
Ink 2,0 : Text 34*8,3+Text Base,"AMAL monitor"
Clw
CL_STR
For N=0 To NSTR
TST_FLG[N]
If Param
DR_STR[N,NSTR,1]
Else
DR_STR[N,NSTR,0]
End If
Next
'
X1REG=5 : X2REG=X1REG+13 : X3REG=X2REG+13 : YREG=3
Print At(X1REG-1,YREG)+Border$(At(X1REG+9,YREG+12),2)
Print At(X2REG-1,YREG)+Border$(At(X2REG+9,YREG+12),2)
Print At(X3REG-1,YREG)+Border$(At(X3REG+14,YREG+9),2)
For N=0 To 26+9 : DR_REG[N,1] : Next
For N=0 To 7 : DR_ACT[N,0] : Next
'
Reset Zone 66
OLDA=-1 : OLDZ=-200
'
Do
Repeat
MVE_ED
Z=Mouse Zone : K=Mouse Key and 1 : K$=Upper$(Inkey$)
If Z-70<>OLDZ
If OLDZ>=0 : IDR_REG[OLDZ,0] : OLDZ=-200 : End If
If Z-70>=0 and Z-70<36 : IDR_REG[Z-70,1] : OLDZ=Z-70 : End If
End If
If Z-106<>OLDA
If OLDA>=0 : DR_ACT[OLDA,0] : OLDA=-1 : End If
If Z-106>=0 : DR_ACT[Z-106,1] : OLDA=Z-106 : End If
End If
Until K$<>"" or K<>0
'
R=0 : A=-1
'
If K<>0 and Z<>0 and Z<NSTR+2
TST_FLG[Z-1]
If Param
CLR_FLG[Z-1]
DR_STR[Z-1,NSTR,0]
Else
SET_FLG[Z-1]
DR_STR[Z-1,NSTR,1]
End If
SEL0=FLG(0) : SEL1=FLG(1)
While Mouse Key : Wend
End If
If K<>0 and OLDZ>=0
IDR_REG[OLDZ,1]
Cmove -4,0
Curs On : INP_TEXT[Mid$(Hex$(REGA(OLDZ),4),2),4] : Curs Off
REGA(OLDZ)=Val("$"+Param$)
DR_REG[OLDZ,-1]
OLDZ=-200
End If
If K<>0 and OLDA=0
If CCH : Dec CCH : For N=26 To 35 : DR_REG[N,1] : Next : Wait 3 : End If
End If
If K<>0 and OLDA=1
If CCH<NSTR-1 : Inc CCH : For N=26 To 35 : DR_REG[N,1] : Next : Wait 3 : End If
End If
If K$="I" or(K<>0 and OLDA=2)
DR_ACT[2,1] : A=2
TST_FLG[0] : If Param : CHRGET[0] : If ALARM : Goto _EDIT : End If : End If
For N=1 To NSTR : TST_FLG[N] : If Param : RAMAL[N] : If ALARM : Goto _EDIT : End If : End If : Next
Amal On
ED_SHOW
R=2
End If
If K$="R" or(K<>0 and OLDA=3)
DR_ACT[3,1] : A=3
Repeat
Synchro
For T=1 To SYNC : MVE_ED : Wait Vbl : Next
Until Inkey$<>""
R=1
End If
If K$="G" or(K<>0 and OLDA=4)
DR_ACT[4,1] : A=4
Centre At(,17)+" Enter register number (A...Z or 0...9): " : INP_TEXT["",1]
R$=Upper$(Param$)
If R$<>""
Centre At(,18)+" Enter value to stop at: " : INP_TEXT["",5]
If Param$<>""
V=Val(Param$)
On Error Goto _GREG
Do
Do
Synchro
For T=1 To SYNC : MVE_ED : Wait Vbl : Next
Exit If Inkey$<>"",2
If(R$>="A") and(R$=<"Z")
R=Amreg(Asc(R$)-65)
Else
R=Amreg(CCH,Asc(R$)-48)
End If
Exit If R=V,2
Loop
_GREG: Resume _GROG
_GROG: Bell : On Error : Exit
Loop
R=1
Centre At(,17)+Space$(70) : Centre At(,18)+Space$(70)
End If
End If
End If
If K$="S" or(K<>0 and OLDA=5)
DR_ACT[5,1] : A=5
Synchro
R=1
End If
If K$=Chr$(27) or(K<>0 and OLDA=6)
DR_ACT[6,1]
Exit
End If
'
If R : For N=0 To 35 : DR_REG[N,R-1] : Next : End If
If A>=0 : If OLDA<>A : DR_ACT[A,0] : End If : End If
'
Loop
Sprite Off
Goto _EDIT
'
Procedure DR_ACT[N,I]
Shared X1REG,X3REG,YREG
If I
Inverse On
Else
Inverse Off
End If
If N=0 : Print At(X3REG-1,YREG+12);Border$(Zone$("<<<<<<",106+N),2); : End If
If N=1 : Print At(X3REG+8,YREG+12);Border$(Zone$(">>>>>>",106+N),2); : End If
If N=2 : Print At(X1REG+44,YREG+0)+Border$(Zone$(" (I) Init screen and AMAL ",106+N),2) : End If
If N=3 : Print At(X1REG+44,YREG+3)+Border$(Zone$(" (R) Run until key press ",106+N),2) : End If
If N=4 : Print At(X1REG+44,YREG+6)+Border$(Zone$(" (G) Go until Reg=Value ",106+N),2) : End If
If N=5 : Print At(X1REG+44,YREG+9)+Border$(Zone$(" (S) Performs one step ",106+N),2) : End If
If N=6 : Print At(X1REG+44,YREG+12)+Border$(Zone$("(ESC) Quit monitor ",106+N),2) : End If
Inverse Off
End Proc
Procedure IDR_REG[N,I]
Shared REGA()
If I
Inverse On
Else
Inverse Off
End If
DR_REG[N,1]
Inverse Off
End Proc
Procedure DR_REG[N,F]
Shared X1REG,X2REG,X3REG,YREG,REGA()
If N<26
If F<0 : Amreg(N)=REGA(N) : End If
V=Amreg(N)
If V<>REGA(N) or F<>0
If N<13
Locate X1REG,YREG+N
Else
Locate X2REG,YREG+N-13
End If
Print Zone$("R"+Chr$(65+N)+"="+Hex$(V,4),70+N);
REGA(N)=V
End If
Else
On Error Goto _DRERR
V=Amreg(CCH,N-26)
If F<0 : Amreg(CCH,N-26)=REGA(N) : V=REGA(N) : End If
If V<>REGA(N)+F
Locate X3REG,YREG+N-26
Print Zone$("R("+Mid$(Str$(CCH),2)+","+Chr$(48+N-26)+")="+Hex$(V,4),70+N);
REGA(N)=V
End If
Pop Proc
_DRERR: Resume _DRER2
_DRER2: On Error
If F
Locate X3REG,YREG+N-26
Print "R("+Mid$(Str$(CCH),2)+","+Chr$(48+N-26)+") ";
Reset Zone 70+N
End If
End If
End Proc
'----------------------------------------------------------------------------
'
_PLAY:
ALARM=0
Reset Zone 1 : Reset Zone 2
PL_INFO : INF_PLAY : PL_STR
DR_STR[CPL+1,NBMOVE+1,1]
MAKE_PLAY
Do
Menu On : Curs Off
Inverse Off : Clw : Print : Centre ">>> Choose a menu option <<<"
Repeat
If Choice
On Choice(1) Gosub PL_EDIT,PL_MVE
Z=0 : Exit
End If
MVE_ED
Z=Mouse Zone : K=Mouse Key and 1 : K$=Inkey$ : S=Scancode : SS=Scanshift
Until K
Menu Off
If Z<>0 and Z<=NBMOVE+2 and CPL<>Z-2
DR_STR[CPL+1,NBMOVE+1,0]
CPL=Z-2 : DR_STR[CPL+1,NBMOVE+1,1] : INF_PLAY
End If
Loop
'
PL_EDIT: Pop
Goto _EDIT
'
PL_MVE:
Menu Off
On Choice(2) Proc PL_TAPE,PL_PLAY,PL_TAPE,PL_INS,PL_DEL
Return
'
Procedure PL_TAPE
PL_CLR[CPL]
Clw
Print : Centre "To record, put the mouse pointer at the start of movement,"
Print : Centre "and enter speed (or press RETURN) to begin recording."
Print : Centre "-> Press ESC to abort <-"
Print : Centre "To stop recording, click the mouse button."
Print : Print : Centre "Movement recording speed: "
Curs On : INP_TEXT["1",3]
'
Clw
If Param$<>""
'
SP=Val(Param$)
If SP<=0 or SP>255 : SP=1 : End If
'
Screen Hide 7 : Wait Vbl
LMVE=2000 : X$=Space$(LMVE) : Y$=Space$(LMVE)
ADX=Varptr(X$) : ADY=Varptr(Y$) : LX=0 : LY=0
XM=X Mouse : YM=Y Mouse
CPTX=-1 : CPTY=-1
Repeat
'
' Tape X movements
X=X Mouse
If X=XM
Inc CPTX
If CPTX>126
Bset 7,CPTX : Poke ADX,CPTX : Inc ADX : Inc LX : CPTX=-1
End If
Else
If CPTX>-1
Bset 7,CPTX : Poke ADX,CPTX : Inc ADX : Inc LX : CPTX=-1
End If
D=X-XM
D=Min(D,63) : D=Max(D,-63)
Bclr 7,D : Poke ADX,D : Inc ADX : Inc LX
XM=X
End If
'
' Tape Y movements
Y=Y Mouse
If Y=YM
Inc CPTY
If CPTY>126
Bset 7,CPTY : Poke ADY,CPTY : Inc ADY : Inc LY : CPTY=-1
End If
Else
If CPTY>-1
Bset 7,CPTY : Poke ADY,CPTY : Inc ADY : Inc LY : CPTY=-1
End If
D=Y-YM
D=Min(D,63) : D=Max(D,-63)
Bclr 7,D : Poke ADY,D : Inc ADY : Inc LY
YM=Y
End If
For S=1 To SP : Wait Vbl : Next
Until Mouse Key or LX>=LMVE or LY>=LMVE
'
Screen Show 7 : Wait Vbl
PL_CLEAN[LX+LY+16]
Clw
Print : Centre "Please enter movement's name (8 letters):"
Locate 36,Y Curs+1
INP_TEXT["Move"+Str$(CPL),8] : A$=Param$
'
BKLEN
C=CPL-1 : AP=Start(4)+Param : AA=AP
Doke Start(4)+PLOFF+C*2,(AP-Start(4)-4)/2
PKSTR[Left$(A$+" ",8),Start(4)+PLNAME+C*8]
Doke AP,SP : Add AP,2
Doke AP,LX+2+4 : Add AP,2
Poke AP,0 : Inc AP
For L=0 To LX-1
Poke AP,Peek(Varptr(X$)+L) : Inc AP
Next
Poke AP,0 : Inc AP
Poke AP,0 : Inc AP
For L=0 To LY-1
Poke AP,Peek(Varptr(Y$)+L) : Inc AP
Next
Poke AP,0 : Inc AP
If Btst(0,AP) : Inc AP : End If
Doke Start(4)+PLLEN+C*2,AP-AA
End If
INF_PLAY
End Proc
Procedure PL_PLAY
Clw
If Deek(Start(4)+PLOFF+CPL*2-2)
Print : Print : Centre ">>> Put the mouse at start of movement, and press mousekey <<<"
WT_CLICK
Screen Hide 7
Synchro Off
X=Free
A$=Space$(8)
Doke Varptr(A$)+2,X Mouse : Doke Varptr(A$)+4,Y Mouse
Amal 63,"PL"+Str$(CPL) To Varptr(A$)
Amal On
Repeat
Synchro
X Mouse=Deek(Varptr(A$)+2) : Y Mouse=Deek(Varptr(A$)+4)
Wait Vbl
Doke Varptr(A$)+2,X Mouse : Doke Varptr(A$)+4,Y Mouse
Until Mouse Key
Amal Off
Screen Show 7
Else
Bell
Print : Centre "Movement not recorded!"
Print : Print : Centre ">>> Press mousekey <<<"
WT_CLICK
End If
End Proc
Procedure PL_CLR[N]
Doke Start(4)+PLOFF+N*2-2,0
Doke Start(4)+PLLEN+N*2-2,0
PKSTR["Empty ",Start(4)+PLNAME+N*8-8]
End Proc
Procedure PL_CLEAN[L]
'
BKLEN
Reserve As Work 5,Param+L : AD=Start(5)
'
PKSTR["Amal ",AD-8]
Doke AD+4,NBMOVE : Add AD,6
AP=Start(5)+PLMOVE
For N=0 To NBMOVE-1
For L=0 To 7
Poke Start(5)+PLNAME+N*8+L,Peek(Start(4)+PLNAME+N*8+L)
Next
A=Deek(Start(4)+PLOFF+N*2)
If A
AO=Start(4)+4+A*2
LO=Deek(Start(4)+PLLEN+N*2)
Doke Start(5)+PLOFF+N*2,(AP-Start(5)-4)/2
Doke Start(5)+PLLEN+N*2,LO
Copy AO,AO+LO To AP
Add AP,LO
End If
Next
'
Erase 4 : Reserve As Data 4,Length(5)
Copy Start(5)-8,Start(5)+Length(5) To Start(4)-8
Erase 5
'
End Proc
Procedure PKSTR[A$,A]
For L=0 To Len(A$)-1
Poke A+L,Asc(Mid$(A$,L+1,1))
Next
End Proc
Procedure BKLEN
L=PLMOVE
For N=0 To NBMOVE-1
Add L,Deek(Start(4)+PLLEN+N*2)
Next
End Proc[L]
Procedure PL_INS
If CPL<NBMOVE
For C=NBMOVE-1 To CPL Step -1
Doke Start(4)+PLOFF+C*2,Deek(Start(4)+PLOFF+C*2-2)
Doke Start(4)+PLLEN+C*2,Deek(Start(4)+PLLEN+C*2-2)
For P=0 To 7
Poke Start(4)+PLNAME+C*8+P,Peek(Start(4)+PLNAME+C*8-8+P)
Next
Next
PL_CLR[CPL]
INF_PLAY
End If
End Proc
Procedure PL_DEL
If CPL<NBMOVE
For C=CPL To NBMOVE-1
Doke Start(4)+PLOFF+C*2-2,Deek(Start(4)+PLOFF+C*2)
Doke Start(4)+PLLEN+C*2-2,Deek(Start(4)+PLLEN+C*2)
For P=0 To 7
Poke Start(4)+PLNAME+C*8-8+P,Peek(Start(4)+PLNAME+C*8+P)
Next
Next
PL_CLR[CPL]
INF_PLAY
End If
PL_CLR[CPL]
End Proc
Procedure PL_STR
CL_STR
For N=2 To NBMOVE+1
DR_STR[N,NBMOVE+1,0]
Next
Reset Zone 1
End Proc
Procedure INF_PLAY
X=30*8
Cls 0,X,3 To 639,11
A$="Movement:"+Str$(CPL)+" - Name: "
For N=0 To 7 : A$=A$+Chr$(Peek(Start(4)+PLNAME+CPL*8+N-8)) : Next
A$=A$+" - Length:"+Str$(Deek(Start(4)+PLLEN+CPL*2-2))
Ink 2,0 : Text X,3+Text Base,A$
End Proc
Procedure PL_INFO
Cls 0,0,0 To 640,12
Set Paint 1 : Set Pattern 0 : Ink 0,0,2 : Bar 0,0 To 639,12
Ink 2,0 : Text 16,3+Text Base,"PLAY movement editor"
End Proc
Procedure MAKE_PLAY
'
Menu Del
Paper 2 : Pen 0
'
Menu$(1)=" Edit "
Menu$(1,1)=" Back to string editor Esc " : Menu Key(1,1) To 69
'
Menu$(2)=" Movement "
Menu$(2,1)=" Record F1 " : Menu Key(2,1) To 80
Menu$(2,2)=" Play back F2 " : Menu Key(2,2) To 81
Menu$(2,3)="---------------" : Menu Inactive(2,3)
Menu$(2,4)=" Insert F3 " : Menu Key(2,4) To 82
Menu$(2,5)=" Delete F4 " : Menu Key(2,5) To 83
'
Paper 1 : Pen 2
'
End Proc
'-----------------------------
_RUNCUR:
INI_FLG : SET_FLG[CST] : SET_FLG[0]
Goto _RUN
'
_RUNALL:
INI_FLG : SET_FLG[0]
For N=1 To NSTR
If AM$(N)<>"" : SET_FLG[N] : End If
Next
Goto _RUN
'
_RUNSEL:
FLG(0)=SEL0 : FLG(1)=SEL1
Goto _RUN
'
_RUN:
ED_HIDE
INIT_RUN
TST_FLG[0] : If Param : CHRGET[0] : If ALARM : Goto _EDIT : End If : End If
For N=1 To NSTR
TST_FLG[N]
If Param : RAMAL[N] : If ALARM : Goto _EDIT : End If : End If
Next
'
If NSTR<16
Amal On
Repeat : Until Inkey$<>""
Amal Off
Else
Amal On
Repeat
Synchro
For T=1 To SYNC : Wait Vbl : Next
Until Inkey$<>""
Amal Off : Synchro
End If
Sprite Off : Update
Goto _EDIT
Procedure INIT_RUN
Amal Off
Synchro Off : If NSTR<60 : Synchro On : End If
End Proc
Procedure RAMAL[N]
'
On Error Goto AM_ERR
A$=Mid$(AM$(N),21)
If A$<>"" : Amal N-1,A$ : End If
Goto E_RAMAL
'
AM_ERR:
CUX=0 : WIY=0 : P=21 : PE=Amalerr+21
Do
Q=Instr(AM$(N),LIM$,P+1)
Exit If Q=0
If Q>PE : WIY=Y : CUX=PE-P : Exit : End If
Inc Y
P=Q+1
Loop
CST=N
AM$(N)=Hex$(CUX,3)+"$000"+Hex$(WIY,3)+Mid$(AM$(N),13)
E=Errn
Restore ERR_LIST
Do
Read A,ALARM$
Exit If A=0 or A=E
Loop
ALARM=250
Resume E_RAMAL
'
ERR_LIST:
Data 107,"Syntax error in animation string"
Data 108,"Next without for"
Data 109,"Label already defined"
Data 110,"Jump to/within autotest"
Data 111,"Autotest already opened"
Data 112,"Instruction only valid in autotest"
Data 113,"Animation string to long! You MUST split it!"
Data 114,"Label not defined"
Data 115,"Illegal instruction during autotest"
Data 0,"Error during declaration"
'
E_RAMAL:
End Proc
Procedure CHRGET[NS]
Dim V(10),V$(10)
'
X=Free
PP=21 : LINE=0
Do
QQ=Instr(AM$(NS),LIM$,PP)
Exit If QQ=0
S$=Mid$(AM$(NS),PP,QQ-PP)
PP=QQ+1
While Left$(S$,1)=" " : S$=Mid$(S$,2) : Wend
'
If Left$(S$,1)<>"'"
'
Repeat
'
While Left$(S$,1)=" " : S$=Mid$(S$,2) : Wend
'
Restore TKENS
Repeat
Read A$,PAR$,JMP$
If A$="" : Goto _SYNT : End If
Until A$=Upper$(Left$(S$,Len(A$)))
'
S$=Mid$(S$,Len(A$)+1)
NP=0 : P=1
While Mid$(S$,P,1)=" " : Inc P : Wend
SP$=Mid$(S$,P,1)
If SP$<>":" and P<=Len(S$)
Do
'
If Mid$(S$,P,1)='"'
Inc NP
If Mid$(PAR$,NP,1)<>"1" : Goto _SYNT : End If
Q=Instr(S$,'"',P+1) : If Q=0 : Goto _SYNT : End If
V$(NP)=Mid$(S$,P+1,Q-P-1)
P=Q+1
While Mid$(S$,P,1)=" " : Inc P : Wend
SP$=Upper$(Mid$(S$,P,1)) : Inc P
Else
Inc NP
If Mid$(PAR$,NP,1)<>"0" : Goto _SYNT : End If
Q=P
Do
SP$=Upper$(Mid$(S$,Q,1))
Exit If(SP$="") or(SP$=",") or(SP$=":") or(SP$="T")
Inc Q
Loop
If P=Q
V(NP)=$80000000
Else
V(NP)=Val(Mid$(S$,P,Q-P))
End If
If SP$="T" : Inc Q : End If
P=Q+1
End If
Exit If SP$=":"
If P>Len(S$)
Exit If(SP$<>",") and(Upper$(SP$)<>"T")
End If
Loop
Else
Inc P
End If
'
If NP<>Len(PAR$) : Goto _SYNT : End If
On Error Goto _RERR
OUT=0 : Wait Vbl : Gosub JMP$ : Update
On Error
Exit If OUT
'
While Mid$(S$,P,1)=" " : Inc P : Wend
S$=Mid$(S$,P)
Until S$=""
End If
Inc LINE
Loop
ALARM$="" : ALARM=0 : X=Free
Pop Proc
'
_SYNT:
ALARM$="Pre-Intrrpretor Error: Syntax error!"
_RERR2: ALARM=250
AM$(NS)="$000$000"+Hex$(LINE,3)+Mid$(AM$(NS),13)
CST=NS : X=Free
On Error
Pop Proc
'
_RERR:
Pop
ALARM$="Pre-Interpretor Error: Illegal function call (or other error)!"
Resume _RERR2
'
WHATSC:
If Screen<>7 Then Return
NO7: Pop : Pop
ALARM$="Pre-Interpretor Error: You can't modify screen 7!"
Goto _RERR2
'
V1NO7: If V(1)=7 Then Goto NO7
Return
'
V2NO7: If V(2)=7 Then Goto NO7
Return
'
TKENS:
Data "SPRITE OFF","","R_SPO"
Data "BOB OFF","","R_BBO"
Data "RAINBOW DEL","","R_RD"
Data "IF SCREEN","0","R_IS"
Data "IF NOT SCREEN","0","R_INS"
Data "IF BANK","0","R_IB"
Data "IF NOT BANK","0","R_INB"
Data "IF REG","00","R_IR"
Data "IF NOT REG","00","R_INR"
Data "SET REG","00","R_SR"
Data "SCREEN OPEN","00000","R_SO"
Data "SCREEN DISPLAY","00000","R_SD"
Data "SCREEN OFFSET","000","R_OF"
Data "DOUBLE BUFFER","","R_DB"
Data "DUAL PLAYFIELD","00","R_DP"
Data "DUAL PRIORITY","00","R_DR"
Data "SCREEN CLONE","0","R_SC"
Data "SCREEN CLOSE","0","R_CC"
Data "SCREEN","0","R_SS"
Data "LOAD IFF","10","R_LD"
Data "BELL","","R_BL"
Data "COLOUR","00","R_CO"
Data "FLASH OFF","","R_FLO"
Data "FLASH","01","R_FL"
Data "ERASE","0","R_ER"
Data "LOAD","10","R_LB"
Data "BOB","0000","R_BB"
Data "SET BOB","0000","R_SBO"
Data "SPRITE","0000","R_SP"
Data "SET SPRITE BUFFER","0","R_SSB"
Data "SET RAINBOW","000111","R_SRB"
Data "RAINBOW","0000","R_RB"
Data "CHANNEL TO SPRITE","00","R_CS"
Data "CHANNEL TO BOB","00","R_CB"
Data "CHANNEL TO SCREEN DISPLAY","00","R_CSD"
Data "CHANNEL TO SCREEN OFFSET","00","R_COF"
Data "CHANNEL TO SCREEN SIZE","00","R_CSS"
Data "CHANNEL TO RAINBOW","00","R_RN"
Data "GET SPRITE PALETTE","0","R_GS"
Data "UPDATE EVERY","0","R_UE"
Data "HIDE","","R_HI"
Data "CLS","0","R_CLS"
Data "UNPACK","00","R_UN"
Data "CURS OFF","","R_CUO"
Data "","",""
'
R_RM: OUT=True : Return
R_IR: If Amreg(V(1))<>V(2) : OUT=True : End If : Return
R_INR: If Amreg(V(1))=V(2) : OUT=True : End If : Return
R_IS: On Error Goto R_I0 : S=Screen : Screen V(1) : Screen S : Return
R_I0: Resume R_STOP
R_INS: On Error Goto R_I1 : S=Screen : Screen V(1) : Screen S : Goto R_STOP
R_I1: Resume R_I2
R_IB: If Length(V(1))=0 : Goto R_STOP : End If : Return
R_INB: If Length(V(1)) : Goto R_STOP : End If : Return
R_STOP: OUT=True
R_I2: Return
'
R_HI: Hide On : Return
R_BBO: Bob Off : Return
R_SPO: Sprite Off : Return
R_SO: Gosub V1NO7 : Screen Open V(1),V(2),V(3),V(4),V(5) : Return
R_SD: Gosub V1NO7 : Screen Display V(1),V(2),V(3),V(4),V(5) : Return
R_OF: Gosub V1NO7 : Screen Offset V(1),V(2),V(3) : Return
R_DB: Gosub WHATSC : Double Buffer : Return
R_DP: Gosub WHATSC : Dual Playfield V(1),V(2) : Return
R_DR: Gosub WHATSC : Dual Priority V(1),V(2) : Return
R_SC: Gosub WHATSC : Screen Clone V(1) : Return
R_CC: Gosub WHATSC : Screen Close V(1) : Return
R_SS: Gosub V1NO7 : Screen V(1) : Return
R_LD: Gosub V2NO7 : Load Iff V$(1),V(2) : Return
R_BL: Bell : Return
R_CO: Gosub WHATSC : Colour V(1),V(2) : Return
R_FLO: Gosub WHATSC : Flash Off : Return
R_FL: Gosub WHATSC : Flash V(1),V$(2) : Return
R_ER: Erase V(1) : Return
R_LB: Load V$(1),V(2) : Return
R_BB: Gosub WHATSC : Bob V(1),V(2),V(3),V(4) : Return
R_SBO: Gosub WHATSC : Set Bob V(1),V(2),V(3),V(4) : Return
R_SP: Sprite V(1),V(2),V(3),V(4) : Return
R_SSB: Set Sprite Buffer V(1) : Return
R_SRB: Set Rainbow V(1),V(2),V(3),V$(4),V$(5),V$(6) : Return
R_RB: Rainbow V(1),V(2),V(3),V(4) : Return
R_RD: Rainbow Del : Return
R_CS: Channel V(1) To Sprite V(2) : Return
R_CB: Channel V(1) To Bob V(2) : Return
R_CSD: Gosub V2NO7 : Channel V(1) To Screen Display V(2) : Return
R_COF: Gosub V2NO7 : Channel V(1) To Screen Offset V(2) : Return
R_CSS: Gosub V2NO7 : Channel V(1) To Screen SizeV(2) : Return
R_RN: Channel V(1) To Rainbow V(2) : Return
R_GS: Gosub WHATSC : Get Sprite Palette V(1) : Return
R_UE: Update Every V(1) : Return
R_SR: Amreg(V(1))=V(2) : Return
R_CLS: Gosub WHATSC : Cls V(1) : Return
R_UN: Gosub V2NO7 : Unpack V(1) To V(2) : Return
R_CUO: Gosub WHATSC : Curs Off : Return
'
End Proc
'------------------------------
Procedure WT_CLICK
While Mouse Key : Wend
Repeat : Until Mouse Key
While Mouse Key : Wend
End Proc
Procedure INP_TEXT[T$,L]
X=X Curs : Y=Y Curs
Locate X,Y : Print T$;
Do
Repeat
MVE_ED
A$=Inkey$
Until A$<>""
Exit If A$=Chr$(13)
If A$=Chr$(8) : T$=Left$(T$,Len(T$)-1) : End If
If A$=Chr$(27) : T$="" : Exit : End If
If A$>" " : T$=T$+A$ : End If
T$=Left$(T$,L) : Locate X,Y : Print T$;" "; : Cleft
Loop
End Proc[T$]
Procedure DR_STR[N,M,I]
X=(640-M*10)/2+N*10-5 : Y=12
I1=0 : I2=2
If I : Swap I1,I2 : End If
Set Paint 1 : Set Pattern 0 : Ink I1,,2 : Bar X,Y To X+10,Y+18
A$=Str$(N-1)-" " : If Len(A$)=1 : A$="0"+A$ : End If
If N=0 : A$="EE" : End If
Ink I2,I1
Text X+1,Y+2+Text Base,Left$(A$,1)
Text X+1,Y+2+8+Text Base,Right$(A$,1)
Set Zone N+1,X,Y+1 To X+9,Y+1+18
End Proc
Procedure INI_FLG
For N=0 To MFLG
FLG(N)=0
Next
End Proc
Procedure SET_FLG[N]
N1=N mod 32 : N2=N/32
Bset N1,FLG(N2)
End Proc
Procedure CLR_FLG[N]
N1=N mod 32 : N2=N/32
Bclr N1,FLG(N2)
End Proc
Procedure TST_FLG[N]
N1=N mod 32 : N2=N/32
End Proc[Btst(N1,FLG(N2))]